using System;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using System.Xml;
using YourCompany.FBFanboxDNN.Components;
using System.Web.UI.WebControls;

namespace YourCompany.Modules.FBFanboxDNN
{
    public partial class EditFBFanboxDNN : PortalModuleBase
    {

        int itemId = Null.NullInteger;

        protected void Page_Load(object sender, EventArgs e)
        {           
               
        }

        public void likeMe()
        {
            Panel fanBoxPanel = new Panel();
            string urlTolike;
            string layoutStyle = "&amp;layout=" + ddlLayoutStyle.SelectedValue.ToString();
            string verbToDisplay = "&amp;action=" + ddlVerb.SelectedValue.ToString();
            string colorScheme = ddlColorScheme.SelectedValue.ToString();

            urlTolike = "http://www.facebook.com/plugins/like.php?href=";
            urlTolike = urlTolike + Request.Url.ToString();
            urlTolike = urlTolike + layoutStyle;
            urlTolike = urlTolike + verbToDisplay;
            Panel likePanel = new Panel();
            Literal likeLiteral = new Literal();
            likeLiteral.Text = urlTolike;
            likePanel.Controls.Add(likeLiteral);
            fanBoxPanel.Controls.Add(likePanel);
            this.Parent.Controls.Add(fanBoxPanel);
        }

        public bool writeToXML()
        {
            XmlDocument writerDoc = new XmlDocument();
            XmlTextWriter docWriter = new XmlTextWriter(Server.MapPath("~/XML/likeConfig.xml"), null);
            
            return false;
        }
         
        public string readFanBoxValues()
        {
            string returnValue = false;
            XmlDocument doc = new XmlDocument();
            XmlTextReader reader = new XmlTextReader(Server.MapPath("~/XML/likeConfig.xml"));
            reader.Read();
            doc.Load(reader);
            
            return returnValue; 
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            likeMe();
        }

        bool save()
        {
            try
            {
                FBFanboxDNNController controller = new FBFanboxDNNController();
                
            }
            catch (Exception)
            {
                
                
            }
            return true;
        }
       
    }
}


